POV-Ray : Newsgroups : povray.advanced-users : Volume-preserving blob : Re: Volume-preserving blob Server Time
29 Jul 2024 12:23:19 EDT (-0400)
  Re: Volume-preserving blob  
From: Retsam
Date: 12 Mar 2003 18:35:03
Message: <web.3e6fc2684cdcaf4d2a3ff2e70@news.povray.org>
Slime wrote:
>> I don't know what is the *correct* or the perfect way to smooth a blob,
>but
>> I just don't like the way the components react to each other sometimes.
>> Sometimes there is a visible edge between two spheres that isn't as smooth
>> as the rest of the blob and usually the appearance of the blob is too
>> smooth.
>
>
>This is due to the exact same mathematical property that causes a similar
>"grid" artifact in the noise function: first derivatives match up, second
>ones don't. It's not an easy problem to solve.
>
> - Slime
>

Actually, I was bothered by this as well, and came up with my own equation
that matches 1st AND 2nd derivatives to 0 at the center and the edge of the
blob component.

In the documentation, they list the blob falloff equation as (1-r^2)^2.
This results in the following values (assuming radius of 1):
Distance from center:
           0.0    0.5     1.0
"density"  1.0    0.5625  0.0
1st der.   0.0   -1.5     0.0
2nd der.  -4.0   -1.0     8.0

As you can see, the second derivatives are quite large.

My function uses the following equation:
1.0 - (6*r^5 - 15*r^4 + 10*r^3)

This equation yeilds the following values:
Distance from center:
           0.0    0.5     1.0
Value      1.0    0.5     1.0
1st der.   0.0   -1.875   0.0
2nd der.   0.0    0.0     0.0

Note that this function has two main advantages over the standard function.
First, it reaches a threshold of 0.5 at exactly half the radius.  This
makes calculating the size of your components very precise.  Second, the
curvature (i.e. 2nd derivative) is 0 at 0, 0.5, at 1 times the radius.  The
benfit of this is that when two components touch, the curvature at the
contact points does not abruptly change (easily noticed if you have a good
eye, but even easier to notice if the surface is reflective/refractive!).

To see this for yourself, calculate the 1st and second derivatives in
symbolic form:
1st: 30*r^2*(r-1)^2
2nd: 120*r*(r-0.5)*(r-1)

Note that the 1st derivative has zeroes (roots) at 0 and 1, whereas the 2nd
derivative has zeroes at 0, 0.5, and 1.  Also note that this equation is
symmetric around r=0.5, whereas the standard formula is not.  This means
that negative blobs can be used more effectively when placed with the
center at the edge of another component, with the same radius.  The
symmetric equations will exactly cancel along the line between the two
components!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.